//
//  FeedListTitleTableViewCell.m
//  TestApplication
//
//  Created by Hanlingyu on 16/9/3.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "FeedListTitleTableViewCell.h"
#import "NewActionChannel.h"
#import "NewActionContent.h"
#import "NewActionImg.h"
#import "UIButton+WebCache.h"
#import "TAMacro.h"
#import "PersonalViewController.h"
@interface FeedListTitleTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *prefixLabel;
@property (weak, nonatomic) IBOutlet UILabel *suffixLabel;
@property (weak, nonatomic) IBOutlet UIButton *userHeader;
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
@property (weak, nonatomic) IBOutlet UIButton *knowUserButton;
@property (weak, nonatomic) IBOutlet UIImageView *vipImage;


@end


@implementation FeedListTitleTableViewCell


- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    
    self = [super initWithCoder:aDecoder];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor colorWithWhite:0.917 alpha:1.000];
        
    }
    return self;
    
}

- (void)clickPersonViewControllerAction:(UIButton *)headerImageButton {
    
    NSLog(@"点击头像");
    UINavigationController *nav = [UIApplication sharedApplication].keyWindow.rootViewController.childViewControllers[0];
    PersonalViewController *personVC = [[PersonalViewController alloc] init];
    personVC.postId =  _actionContent.uid;
    NSLog(@"%@", _actionContent.uid);
    [nav pushViewController: personVC animated:YES];
    
    
    
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setActionContent:(NewActionContent *)actionContent {
    _actionContent = actionContent;
    [_userHeader addTarget:self action:@selector(clickPersonViewControllerAction:) forControlEvents:UIControlEventTouchUpInside];

    _prefixLabel.text = _actionContent.channel.prefix;
    _suffixLabel.text = _actionContent.channel.suffix;
    [_userHeader sd_setBackgroundImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://qn.zheli.io/%@", _actionContent.avatar]] forState:UIControlStateNormal];
    _userHeader.imageView.contentMode = UIViewContentModeScaleAspectFill;
    _userHeader.imageView.layer.masksToBounds = YES;
    _userNameLabel.text = _actionContent.uname;
    
    if (_actionContent.isTalent == 0) {
        _vipImage.hidden = YES;
    } else {
        _vipImage.hidden = NO;
    }

}

- (void)layoutSubviews {
    [super layoutSubviews];
}




@end
